package com.toocms.jinjuhang.ui.index.article_details

import android.os.Bundle
import androidx.databinding.ObservableField
import com.toocms.jinjuhang.config.Constants
import com.toocms.jinjuhang.data.goods.CommodityItemData
import com.toocms.jinjuhang.ui.commodity.detils.CommodityDetailsFgt
import com.toocms.tab.base.BaseViewModel
import com.toocms.tab.base.ItemViewModel
import com.toocms.tab.binding.command.BindingAction
import com.toocms.tab.binding.command.BindingCommand

class ArticleDetailsRecommendCommodityItemModel(
    viewModel: BaseViewModel<*>,
    val item: ObservableField<CommodityItemData>
) :
    ItemViewModel<BaseViewModel<*>>(viewModel) {

    val itemClickBindingCommand = BindingCommand<BindingAction>(BindingAction {
        item.get()?.apply {
            val bundle = Bundle()
            bundle.putString(Constants.BundleKey.KEY_GOODS_ID, goods_id)
            viewModel.startFragment(CommodityDetailsFgt::class.java, bundle)
        }
    })


}